package com.blog.controller;

import com.blog.Utils.Result;
import com.blog.bean.dto.CourseClassDTO;
import com.blog.service.CourseClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author 任浩
 * @version 1.0
 */

@RestController
@RequestMapping("/courseClass")
public class CourseClassController {

    @Autowired
    private CourseClassService courseClassService;


    /**
     * 新增课程分类
     * @param courseClass
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody CourseClassDTO courseClass){
        return courseClassService.add(courseClass);
    }

    /**
     * 获取课程分类
     * @return
     */
    @GetMapping("/getAll")
    public Result<List<Map<String,Object>>> getAll(){
        return courseClassService.getAll();
    }

}
